package learnjava.concur.chapter8;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class P102 {
}


/**
 * 自定义不可重入锁
 */
class MyLock implements Lock {

    //同步器类
    class Mysync extends AbstractQueuedSynchronizer{

    }

    private Mysync sync = new Mysync();

    @Override //加锁，不成功会进入等待队列
    public void lock() {
//        ReentrantReadWriteLock
    }

    @Override //加锁，可打断
    public void lockInterruptibly() throws InterruptedException {

    }

    @Override //尝试加锁，只尝试一次
    public boolean tryLock() {
        return false;
    }

    @Override //尝试加锁，带超时
    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
        return false;
    }

    @Override //释放锁
    public void unlock() {

    }

    @Override //创建等待条件
    public Condition newCondition() {
        return null;
    }
}
